<template>
    <!-- 外层容器 -->
    <el-container>

        <!-- 左侧状态栏 -->
        <el-aside :width="menuStore.menuWidth" class="transition-all">
            <AdminMenu/>
        </el-aside>

        <!-- 右侧状态栏 -->
         <el-container>
            <el-header>
                <AdminHeader/>
            </el-header>

            <el-main>
                <AdminTagList/>

                <!-- 主内容 (根据不同的 router 动态展示不同的界面) -->
                 <router-view v-slot="{ Component }">
                    <Transition name="fade">
                        <!-- max 指定最多保留 10 个组件 -->
                        <KeepAlive :max="10">
                            <component :is="Component"></component>
                        </KeepAlive>
                    </Transition>
                 </router-view>
            </el-main>

            <el-footer>
                <AdminFooter/>  
            </el-footer>
         </el-container>

    </el-container>
</template>

<script setup>
import AdminFooter from './components/AdminFooter.vue';
import AdminHeader from './components/AdminHeader.vue';
import AdminMenu from './components/AdminMenu.vue';
import AdminTagList from './components/AdminTagList.vue';
import { useMenuStore } from '@/stores/menu';
import { onMounted } from 'vue';

const menuStore = useMenuStore()


onMounted(() => {
    // 去除 HTML 中间的黑色属性
    document.documentElement.classList.remove('dark');
})
</script>

<style scoped>
.el-header {
    padding: 0!important;
}

/* 内容过渡动画 */
/* 刚进入的时候 */
.fade-enter-from {
    /* 透明度 */
    opacity: 0;
}

.fade-enter-to {
    opacity: 1;
}

.fade-leave-from {
    opacity: 1;
}

.fade-leave-to {
    opacity: 0;
}

.fade-leave-active {
    transition: all 0.3s;
}

.fade-enter-active {
    transition: all 0.3s;
    transition-delay: 0.3s;
}
</style>